package com.wzcl.app.dao.model;


import com.wzcl.app.dao.model.common.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "CourseComment",
        indexes = {
                @Index(columnList = "courseId"),
                @Index(columnList = "parentId")
        }
)
@ApiModel(value = "课程评价表")
@EntityListeners(AuditingEntityListener.class)
public class CourseComment implements Base {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "课程Id")
    private Integer courseId;

    @ApiModelProperty(value = "用户Phone")
    private String userPhone;

    @ApiModelProperty(value = "评论")
    private String comment;

    @CreatedDate
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "父Id")
    private Integer parentId;

    @ApiModelProperty(value = "用户Id")
    private Integer userId;

    @ApiModelProperty(value = "用户头像")
    private String userHeadIcon;

    @Transient
    @ApiModelProperty(value = "用户昵称")
    private String userNickName;

    @Transient
    List<CourseComment> commentList;
}
